#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#define MAXN 505
#define MAXM 100005
using namespace std;

int N, L;
int knots[MAXN];
int dif[MAXN];

int intcmp(const void *va, const void *vb){
    return *((int *) va) - *((int *) vb);
}

bool check_palin(int start, int end){
    for (int i=0;start+i <= end-i;i++)
        if (dif[start+i] != dif[end-i])
            return false;
    return true;
}

int main()
{
    freopen("folding.txt","r", stdin);
    scanf("%d%d", &N, &L);
    for (int i=0;i<N;i++){
        scanf("%d", &knots[i]);
    }
    qsort(knots, N, sizeof(knots[0]), intcmp);
    for (int i=0;i<N-1;i++)
        dif[i] = knots[i+1] - knots[i];

    int ans = 0;
    for (int i=0;i<N-1;i++)
        if (check_palin(0, i)) ans++;
    for (int i=1;i<N-1;i++)
        if (check_palin(i, N-2)) ans++;
    printf("%d\n", ans);
    return 0;
}
